#include "videoresponsetoclient.h"

VideoResponseToClient::VideoResponseToClient(const UserId& requestUserId,
    const FriendId& responseUserId, const Status& status, const Ip& responseUserIp)
{
    m_messageType = MessageType::VideoResponseToClient;
    m_requestUserId = requestUserId;
    m_responseUserId = responseUserId;
    m_status = status;
    m_responseUserIp = responseUserIp;
}
VideoResponseToClient::VideoResponseToClient(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_requestUserId = jsonObj[JsonKey::USER_ID].toString();
    m_responseUserId = jsonObj[JsonKey::FRIEND_ID].toString();
    m_status = jsonObj[JsonKey::STATUS].toString();
    m_responseUserIp = jsonObj[JsonKey::USER_IP].toString();
}
QJsonObject VideoResponseToClient::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::USER_ID] = m_requestUserId;
    jsonObj[JsonKey::FRIEND_ID] = m_responseUserId;
    jsonObj[JsonKey::STATUS] = m_status;
    jsonObj[JsonKey::USER_IP] = m_responseUserIp;
    return jsonObj;
}
UserId VideoResponseToClient::getRequestUserId() const
{
    return m_requestUserId;
}
FriendId VideoResponseToClient::getResponseUserId() const
{
    return m_responseUserId;
}
Status VideoResponseToClient::getStatus() const
{
    return m_status;
}
Ip VideoResponseToClient::getResponseUserIp() const
{
    return m_responseUserIp;
}
